package com.lry.jvm.instructions.control;
import com.lry.jvm.instructions.base.NoOperandsInstruction;
import com.lry.jvm.rtda.Frame;
import com.lry.jvm.rtda.JObject;
import com.lry.jvm.rtda.JThread;

public class dreturn extends NoOperandsInstruction {
    @Override
    public byte getOpCode() {
        return (byte) 0xaf;
    }

    @Override
    public void execute(Frame frame) throws Exception {
        JThread thread = frame.getThread();

        //A方法调用B方法

        //当前方法的帧 B
        Frame curFrame = thread.popFrame();

        //调用方的帧 A
        Frame invokeFrame = thread.peekFrame();

        double obj = curFrame.getOperandStack().popDouble();

        invokeFrame.getOperandStack().pushDouble(obj);
    }
}
